﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace HOG.Controls
{
    public delegate void OptionValueDelegate(double value);

    public partial class Options : UserControl
    {
        public Options()
        {
            InitializeComponent();
            //if (BrightnessChanged != null)
            //    BrightnessChanged(0.0);
            //if (ContrastChanged != null)
            //    ContrastChanged(0.5);
            //if (GammaChanged != null)
            //    GammaChanged(0.0);
        }

        public event EventHandler Close;
        public event OptionValueDelegate BrightnessChanged;
        public event OptionValueDelegate ContrastChanged;
        public event OptionValueDelegate GammaChanged;
        
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (Close != null)
                Close(sender, e);
        }

        private void sliderBrightness_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<double> e)
        {
            if (BrightnessChanged != null)
                BrightnessChanged(e.NewValue);
        }

        private void sliderContrast_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (ContrastChanged != null)
                ContrastChanged(e.NewValue);
        }

        private void sliderGamma_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (GammaChanged != null)
                GammaChanged(e.NewValue);
        }

        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Host.Content.IsFullScreen = cbFullScreen.IsChecked.Value;
        }
    }
}
